package org.maiyodemo;

import java.util.List;

import org.apache.cxf.frontend.ClientProxy;
import org.maiyodemo.interceptor.AuthInterceptor;
import org.maiyoframework.assist.webservice.MaiyoCoreWs;
import org.maiyoframework.assist.webservice.MaiyoCoreWsImplService;
import org.maiyoframework.assist.webservice.User;

/**
 * Java Project项目调用maiyo-core中通过结合Spring发布WebService的示例
 * 
 * @author maiYo
 * 
 */
public class Client4MaiyoCore {

	public static void main(String[] args) {
		MaiyoCoreWsImplService factory = new MaiyoCoreWsImplService();
		MaiyoCoreWs ws = factory.getMaiyoCoreWsImplPort();
		org.apache.cxf.endpoint.Client client = ClientProxy.getClient(ws);
		client.getOutInterceptors().add(new AuthInterceptor("maiyo", "123321"));
		List<User> users = ws.findListByEmail("k");
		for (User u : users)
			System.out.println(u.getEmail() + " - " + u.getRegisterTime());

	}

}
